package com.kalle.workflow.query;

import com.kalle.workflow.elements.Deployment;
import com.kalle.workflow.mapper.DeploymentMapper;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

public class DeploymentQuery extends AbstractQuery<Deployment> {

    private final DeploymentMapper deploymentMapper;

    private final Map<String, Object> conditionMap;

    public DeploymentQuery(DeploymentMapper deploymentMapper) {
        this.deploymentMapper = deploymentMapper;
        this.conditionMap = new HashMap<>();
    }

    public DeploymentQuery id(String id) {
        conditionMap.put("id", id);
        return this;
    }

    public DeploymentQuery name(String name) {
        conditionMap.put("name", name);
        return this;
    }

    public DeploymentQuery processKey(String processKey) {
        conditionMap.put("processKey", processKey);
        return this;
    }

    public List<Deployment> list() {
        return deploymentMapper.list(conditionMap);
    }

}
